<?php

namespace app\api\model;

use think\Model;

class UserMoneyLog extends Model
{
    protected $autoWriteTimestamp = false;
    /**
     * 新增余额变化
     */
    public static function add($user, $money, $memo = '')
    {
        return self::create([
            'user_id' => $user->user_id,
            'money' => $money,
            'before' => $user->money,
            'after' => $user->money + $money,
            'memo' => $memo,
            'createtime' => time()
        ]);
    }
}
